<?
//统计符合条件的数据

//table:表格
//condition:搜索条件
//不填写conditon则表示直接获取表格数据数目

function  count_by_item($table,$condition)
{

 if($condition)
 {
  $condition="where $condition";
 }
 else
 {
  $condition="";
 }


 $sqlstr="select count(nid) from $table $condition";

 $values = mysql_result(mysql_query($sqlstr), 0);

 mysql_close($con);

 return $values ;

}



?>
